import request from '@/utils/request'
// var authorization =  window.localStorage.getItem('token')


/////////////////***开通账户***///

// 查询商户
export function getForm (data) {
  return request({
    url: '/plateAdmin/getForm',
    method: 'post',
    data:data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 添加商户
export function addMerchant (data) {
  return request({
    url: '/plateAdmin/addMerchant',
    method: 'post',
    data:data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 修改商户
export function changeAdmin (data) {
  return request({
    url: '/plateAdmin/updateAdmin',
    method: 'post',
    data:data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 删除商户
export function deleteAdmin (data) {
  return request({
    url: '/plateAdmin/deleteAdmin',
    method: 'post',
    params:data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 商户信息管理员信息回显
export function echoAdmin (data) {
  return request({
    url: '/plateAdmin/echoAdmin',
    method: 'post',
    params:data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

/////////////////***开通账户***///




/////////////////***设备录入***///

// 获取商户信息
export function getEquipInfo (data) {
  return request({
    url: '/equipInfo/getForm',
    method: 'post',
    data:data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 获取设备分组
export function getEquipForm (data) {
  return request({
    url: '/equipInfo/equipForm',
    method: 'post',
    params:data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 获取设备类型下拉选
export function getSelection (data) {
  return request({
    url: '/equipInfo/getSelection',
    method: 'get',
    data:data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 添加设备分组
export function addEquipConfirm (data) {
  return request({
    url: '/equipInfo/addEquip',
    method: 'post',
    data:data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}


// 查看设备详情
export function lookDetail (data) {
  return request({
    url: '/equipInfo/getExportFormData?current='+data.current+'&groupId='+data.groupId+'&merchantId='+data.merchantId+'&pageSize='+data.pageSize,
     // url: 'platform/sort?id=' + data.id +'&sort=' + data.sort,
    method: 'get',
    // data:data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}


//   导出模板
export function downLoad () {
  return request({
    url: '/equipInfo/exportModel',
    method: 'get',
    responseType: 'blob',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 导出表单文件
export function exportEquip (data) {
  return request({
    url: '/equipInfo/exportFormData?merchantId='+data.merchantId+'&groupId='+data.groupId,
    method: 'get',
    responseType: 'blob',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 导入单条数据
export function insertEquip (data) {
  return request({
    url: '/equipInfo/insertEquip',
    method: 'post',
    data:data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 批量导入设备信息
export function importData (data) {
  return request({
    url: '/equipInfo/importData?merchantId='+data.merchantId+'&groupId='+data.groupId,
    method: 'post',
    data:data.fd,
    headers: {
      'Content-Type': 'multipart/form-data',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 移除设备
export function removeEquip (data) {
  return request({
    url: '/equipInfo/remove',
    method: 'post',
    data:data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

/////////////////***设备录入***///
